home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 121 / Computer Shopper 121 / Computer Shopper 121.iso / HomeBus / money / Money98 / Tour / planner / realdata.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-04-07  |  2.8 KB  |  82 lines

  1. import java.applet.Applet;
  2. import java.io.DataInputStream;
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5. import java.net.MalformedURLException;
  6. import java.net.URL;
  7.  
  8. public class realdata extends Applet {
  9.    private String m_URL = "";
  10.    private final String PARAM_URL = "URL";
  11.    DataInputStream input;
  12.    URL resource;
  13.    String inputLine;
  14.    String Total;
  15.    InputStream res;
  16.  
  17.    public void start() {
  18.    }
  19.  
  20.    public String[][] getParameterInfo() {
  21.       String[][] info = new String[][]{{"URL", "String", "URL of file to be read"}};
  22.       return info;
  23.    }
  24.  
  25.    public void stop() {
  26.    }
  27.  
  28.    public int NewURL(String s) {
  29.       this.m_URL = s;
  30.       return 1;
  31.    }
  32.  
  33.    public String About() {
  34.       return "AppletName: RealData\r\n" + "Author: Hans Hugli\r\n" + "Version: 1.0 build 1";
  35.    }
  36.  
  37.    public String OpenFile() {
  38.       try {
  39.          this.resource = new URL(((Applet)this).getDocumentBase(), this.m_URL);
  40.       } catch (MalformedURLException var6) {
  41.          return ((Throwable)var6).getMessage();
  42.       }
  43.  
  44.       try {
  45.          this.res = this.resource.openStream();
  46.       } catch (IOException var3) {
  47.          return "openStream " + ((Throwable)var3).getMessage();
  48.       } catch (SecurityException var4) {
  49.          return "openStream " + ((Throwable)var4).getMessage();
  50.       } catch (Exception var5) {
  51.          return "openStream " + ((Throwable)var5).getMessage();
  52.       }
  53.  
  54.       try {
  55.          this.input = new DataInputStream(this.res);
  56.  
  57.          for(this.Total = this.input.readLine(); (this.inputLine = this.input.readLine()) != null; this.Total = this.Total + "\n" + this.inputLine) {
  58.          }
  59.       } catch (MalformedURLException var7) {
  60.          return "Malformed URL Exception";
  61.       } catch (IOException var8) {
  62.          return ((Throwable)var8).getMessage();
  63.       } catch (Exception var9) {
  64.          return ((Throwable)var9).getMessage();
  65.       }
  66.  
  67.       return this.Total + "\n" + "Done";
  68.    }
  69.  
  70.    public void destroy() {
  71.    }
  72.  
  73.    public void init() {
  74.       String param = ((Applet)this).getParameter("URL");
  75.       if (param != null) {
  76.          this.m_URL = param;
  77.       }
  78.  
  79.       ((Applet)this).resize(1, 1);
  80.    }
  81. }
  82.